<?php

namespace App\Transformers\System;

use League\Fractal\TransformerAbstract;
use App\Models\FailedJobs;

class GetFailedJobsPageTransformer extends TransformerAbstract
{
    public function transform(FailedJobs $failedJobs)
    {
        $data = $failedJobs->toArray();
        $payload = data_get($data, 'payload') ? \GuzzleHttp\json_decode($data['payload']): null;

        unset($data['payload']);
        data_set($data, 'payload', $payload);

        return $data;
    }
}
